#!/bin/bash
mkdir /etc/yum.repos.d/bak
mv /etc/yum.repos.d/Cent* /etc/yum.repos.d/bak

mount /dev/cdrom /mnt
cat > /etc/yum.repos.d/local.repo << EOF
[centos]
name=centos
baseurl=file:///mnt/
gpgcheck=0
enabled=1
EOF

yum clean all
yum repolist all
sleep 5

systemctl stop firewalld
setenforce 0

yum install -y net-tools
yum install –y vsftpd
sleep 3


echo '# Example config file /etc/vsftpd/vsftpd.conf

anonymous_enable=YES
anon_umask=022
anon_other_write_enable=YES
 local_enable=YES
write_enable=YES
local_umask=022
anon_upload_enable=YES
anon_mkdir_write_enable=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=NO
listen_ipv6=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
' > /etc/vsftpd/vsftpd.conf

systemctl start vsftpd

cd /var/ftp/pub
chown -Rf ftp /var/ftp/pub
mkdir sales
mkdir promote
chown -Rf ftp /var/ftp/pub/sales
chown -Rf ftp /var/ftp/pub/promote
echo "wyl销售网的测试" >> sales/index.html	
echo "wyl宣传网的测试" >> promote/index.html

yum install  -y httpd
systemctl start httpd

cd /etc/httpd/conf
sleep 1
sed "353d" httpd.conf
sleep 2
echo '<VirtualHost 192.168.23.11>
	DocumentRoot /var/ftp/pub/sales
	ServerName "www.wylsales.cn"
	<Directory /var/ftp/pub/sales>
		AllowOverride None
		Require all granted
	</Directory>
</VirtualHost>
<VirtualHost 192.168.23.11>
	DocumentRoot /var/ftp/pub/promote
	ServerName "www.wylpromote.com"
	<Directory /var/ftp/pub/promote>
		AllowOverride None
		Require all granted
	</Directory>
</VirtualHost>
# Load config files in the "/etc/httpd/conf.d" directory, if any.
IncludeOptional conf.d/*.conf
'  >> httpd.conf

systemctl restart httpd
